//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    internal class Cell3D : IOfficeXmlSerializable
    {
        private const string xmlName = "cell3D";
        private Bevel _bevel;
        private OfficeArtExtensionList _extLst;
        private LightRig _lightRig;
        private PresetMaterialType _prstMaterial = PresetMaterialType.Plastic;

        #region IOfficeXmlSerializable Members

        public void ReadXml(ReadContext context)
        {
            using (var c = context.Read(xmlName))
            {
                _prstMaterial = c.GetOptionalEnum("prstMaterial", PresetMaterialType.Plastic);
                _bevel = c.ReadElementAs<Bevel>("bevel");
                _lightRig = c.ReadOptionalElement<LightRig>("lightRig");
                _extLst = c.ReadOptionalElement<OfficeArtExtensionList>("extLst");
            }
        }

        public void WriteXml(WriteContext context)
        {
            using (var c = context.Write(xmlName))
            {
                c.SetOptionalEnum("prstMaterial", _prstMaterial, PresetMaterialType.Plastic);
                c.WriteElementAs(_bevel, "bevel");
                c.WriteOptionalElement(_lightRig);
                c.WriteOptionalElement(_extLst);
            }
        }

        #endregion
    }
}